/*
 * File HtmlAble.java
 * Author: Bill Hamilton
 * 
 * HtmlAble is an abstract class that allows implementing classes to have the getHTML function to be called in order to get an
 * HTML representation of that item.  Basically a lot of helper stuff for the gui.  Note: All the leaf elements in our tree should be HTMLAbles.
 */
import java.util.*;

import javax.swing.JTextPane;

public abstract class HtmlAble implements Comparable {
	
	//get basic html representation for the HtmlAble
	public abstract String getHTML();
	
	//concatenates the html from a bunch of different HtmlAbles
	public static String getHTML(Collection<? extends HtmlAble> list)
	{
		if(list.size() <= 0)
			return "";
		Iterator<? extends HtmlAble> it = list.iterator();
		String rep = it.next().getHTML();
		while(it.hasNext())
			rep+= heavyHoriztonalrule + it.next().getHTML();
		return rep;
	}
	
	public int compareTo(Object o)
	{
		HtmlAble other = (HtmlAble)o;
		return this.toString().compareTo(other.toString());
	}
	
	public static final String lightHoriztonalrule = "<br/>----------------------------------------------------<br/><br/>";
	public static final String heavyHoriztonalrule = "<br/>####################################################<br/><br/>";
}
